class CreateChatSessions < ActiveRecord::Migration
  def self.up
    create_table :chat_sessions do |t|
      t.string :name
      t.text :description
      t.datetime :start
      t.datetime :stop
      t.string :status, :limit=>1
      t.timestamps
    end
    create_table :chat_participants do |t|
      t.integer :chat_session_id
      t.integer :user_id
    end
    add_column :chats, :chat_session_id, :integer
  end

  def self.down
    drop_table :chat_sessions
    drop_table :chat_participants
    remove_column :chats, :chat_session_id
  end
end
